package design.structural.proxy;

/**
 * @author zxs
 * @since 2020/05/26
 */
public class TargetProxy implements MyInterface {

    private int count=0;

    private MyInterface target;

    public TargetProxy() {
        this.target = new Target();
    }

    @Override
    public void doSomething() {
        System.out.println("proxy do something");
        if(count<3){
            target.doSomething();
            count++;
        }else{
            System.out.println("最多执行3次");
        }
    }
}
